GtkPlacesSidebar: Hold a reference to the sidebar while a D-Bus proxy is being created
authorFederico Mena Quintero <federico@gnome.org>
Fri, 12 Apr 2013 01:04:53 +0000 (20:04 -0500)
committerFederico Mena Quintero <federico@gnome.org>
Fri, 12 Apr 2013 01:04:53 +0000 (20:04 -0500)
The creation is async, and the sidebar could be destroyed while the D-Bus proxy is being created.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
gtk/gtkplacessidebar.c

index cf780503b37355bcdb21d0ce8fcb02777ae26c87..e7dc6cbbd8f7325c6c592245812f7444aa28d120 100644 (file)
@@ -3301,6 +3301,8 @@ hostname_proxy_new_cb (GObject      *source_object,
        sidebar->hostnamed_proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
        g_clear_object (&sidebar->hostnamed_cancellable);
 
+       g_object_unref (sidebar);
+
        if (error != NULL) {
                g_debug ("Failed to create D-Bus proxy: %s", error->message);
                g_error_free (error);
@@ -3588,7 +3590,7 @@ gtk_places_sidebar_init (GtkPlacesSidebar *sidebar)
                                  "org.freedesktop.hostname1",
                                  sidebar->hostnamed_cancellable,
                                  hostname_proxy_new_cb,
-                                 sidebar);
+                                 g_object_ref (sidebar));
 }
 
 static void